package com.cloud2022.order.scheduled;

import com.cloud2022.order.oss.OssUtil;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.io.File;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author: create by God of SJF
 * @version: v1.0
 * @description: com.cloud2022.order.scheduled
 * @date:2022/2/7
 */
@Component
public class TestOss {

    @Resource
    OssUtil ossUtil;

//    @Scheduled(cron = "0/1 * * * * ? ")
    public void test() throws Exception {
        File file = new File("/Users/libin/Desktop/setting.xml");
        String fileKey = "excel/setting.xml";
        ossUtil.putObject(fileKey,file);
    }

    public static void main(String[] args) throws ParseException {
        Date dNow = new Date( );
        SimpleDateFormat ft = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss");
        String time = "2022-03-02 15:50:00";
        dNow = ft.parse(time);
        System.out.println(dNow.getTime());
    }
}
